package org.xiaojl.modules.task.entity;

import java.util.Date;

import org.hibernate.validator.constraints.NotBlank;
import org.xiaojl.common.base.BaseEntity;
import org.xiaojl.utils.ToolUtil;

import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

/**
 * <p>
 * 定时任务表
 * </p>
 *
 * @author xiaojl
 * @since 2017-08-29
 */
@TableName("task_job")
public class TaskJob extends BaseEntity<TaskJob> {

    private static final long serialVersionUID = 1L;

    /**
     * 任务名称
     */
    @NotBlank(message="任务名称不能为空")
	private String jobName;
    /**
     * 任务分组
     */
    @NotBlank(message="任务分组不能为空")
	private String jobGroup;
    /**
     * 任务状态 是否启动任务
     */
    @NotBlank(message="启动状态不能为空")
	private String jobStatus;
    /**
     * cron表达式
     */
	@NotBlank(message="cron表达式不能为空")
	private String cron;
    /**
     * 描述
     */
	private String description;
    /**
     * spring bean ID
     */
	@NotBlank(message="任务SpringBeanID不能为空")
	private String beanId;
    /**
     * 任务执行时调用哪个类的方法 包名+类名
     */
	@NotBlank(message="任务SpringBeanClass不能为空")
	private String beanClass;
    /**
     * 任务调用的方法名
     */
	@NotBlank(message="调用的方法不能为空")
	private String methodName;
    /**
     * 任务是否有状态（是否并发任务）
     */
	@NotBlank(message="并发状态不能为空")
	private String isConcurrent;
    /**
     * 更新时间
     */
	private Date updateTime;

	@Override
	public Wrapper<TaskJob> bindingQueryWrapper() {
		Wrapper<TaskJob> wrapper = new EntityWrapper<TaskJob>();
		if(ToolUtil.isNotEmpty(this.jobName)){
			wrapper.like("jobName", this.jobName);
		}
		if(ToolUtil.isNotEmpty(this.jobGroup)){
			wrapper.like("jobGroup", this.jobGroup);
		}
		if(ToolUtil.isNotEmpty(this.jobStatus)){
			wrapper.like("jobStatus", this.jobStatus);
		}
		if(ToolUtil.isNotEmpty(this.cron)){
			wrapper.like("cron", this.cron);
		}
		if(ToolUtil.isNotEmpty(this.description)){
			wrapper.like("description", this.description);
		}
		if(ToolUtil.isNotEmpty(this.beanId)){
			wrapper.like("beanId", this.beanId);
		}
		if(ToolUtil.isNotEmpty(this.beanClass)){
			wrapper.like("beanClass", this.beanClass);
		}
		if(ToolUtil.isNotEmpty(this.methodName)){
			wrapper.like("methodName", this.methodName);
		}
		if(ToolUtil.isNotEmpty(this.isConcurrent)){
			wrapper.like("isConcurrent", this.isConcurrent);
		}
		return wrapper;
	}


	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getJobGroup() {
		return jobGroup;
	}

	public void setJobGroup(String jobGroup) {
		this.jobGroup = jobGroup;
	}

	public String getJobStatus() {
		return jobStatus;
	}

	public void setJobStatus(String jobStatus) {
		this.jobStatus = jobStatus;
	}

	public String getCron() {
		return cron;
	}

	public void setCron(String cron) {
		this.cron = cron;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getBeanId() {
		return beanId;
	}

	public void setBeanId(String beanId) {
		this.beanId = beanId;
	}

	public String getBeanClass() {
		return beanClass;
	}

	public void setBeanClass(String beanClass) {
		this.beanClass = beanClass;
	}

	public String getMethodName() {
		return methodName;
	}

	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	public String getIsConcurrent() {
		return isConcurrent;
	}

	public void setIsConcurrent(String isConcurrent) {
		this.isConcurrent = isConcurrent;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

}
